import React from "react";
import { Select, Input, Radio, Button } from 'antd'
import './NoticeNew.css'
import { Link ,withRouter} from 'react-router-dom'
import axios from '../../../util/http';
import * as url from '../../../util/api'
const { Option } = Select;
const { TextArea } = Input;
class NoticeNew extends React.Component {
  constructor(props) {
    super(props);
    this.state = {
      value: 1,
    };
  }
  onChange = e => {
    console.log('radio checked', e.target.value);
    this.setState({
      value: e.target.value,
    });
  };
  add=()=> {
    console.log(123)
    axios({
      url: url.announcementAdd,
      method: 'post',
      data: {
        content: "string",      //公告内容
        noticeType: "string",     //公告类型
        release_Time: {               //发布时间
          date: 0,
          day: 0,
          hours: 0,
          minutes: 0,
          month: 0,
          nanos: 0,
          seconds: 0,
          time: 0,
          timezoneOffset: 0,
          year: 0
        }
      }
    }).then(res=>{
      console.log(res)
      // if(){}else{} //200跳转
      this.props.history.push('/homepage/notificationannouncement')
    })
  }
  render() {
    return (
      <div>
        <div className={'tongzhiTitle'}>
          <span>标题</span>
          <Input />
        </div>
        <div className={'tongzhiType'}>
          <span>类型</span>
          <Select defaultValue="" className={'tongzhiSelect'} onChange={this.handleChangeOne}>
            <Option value="营销物料">营销物料</Option>
            <Option value="政策发文">政策发文</Option>
            <Option value="最新通知">最新通知</Option>
            <Option value="公司制度">公司制度</Option>
          </Select>
        </div>
        <div className={'tongzhiWord'}>
          <span>内容</span>
          <TextArea rows={4} />
        </div>
        <div className={'tongzhiMessage'}>
          <span>附件信息</span>
          <div>
            <span>添加附件（附件最大20M，支持格式：PDF、Word、Excel、Txt、JPG、PNG、BMP、GIF、RAR、ZIP）</span>
            <span>暂无附件</span>
          </div>
        </div>
        <div className={'tongzhiCarousel'}>
          <span>文字轮播</span>
          <div>
            <Radio>开启</Radio>
          </div>
        </div>
        <div className={'tongzhiObj'}>
          <span>发送对象</span>
          <div>
            <Radio.Group onChange={this.onChange} value={this.state.value}>
              <Radio value={1}>全部经销商</Radio>
              <Radio value={2}>全部员工</Radio>
            </Radio.Group>
          </div>

        </div>
        <div className={'final'}>
          <Button className={'button'} style={{ backgroundColor: 'white', border: '1px solid #D3D3D3', color: 'black' }} type="primary">取消</Button>
          {/* <Link to="/homepage/notificationannouncement"> */}
            <Button onClick={this.add} className={'button'} style={{ backgroundColor: '#4BD0B6', border: '#4BD0B6' }} type="primary">保存</Button>
          {/* </Link> */}
        </div>
      </div>
    );
  }
}
export default withRouter(NoticeNew)